﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ApmetrixDLL
{
    /**
         * Checks internet connectivity
         */
    class ApmetrixConnectionManager
    {

        private static readonly string TAG = "Apmetrix SDK / Connection Manager";
        private static ApmetrixConnectionManager singleton = null;


        private ApmetrixConnectionManager() { }

        /*
         * Singleton design pattern for ApmetrixLocationService
         */
        protected internal static ApmetrixConnectionManager getInstance()
        {
            // if class has not been instantiated yet
            if (singleton == null)
            {
                singleton = new ApmetrixConnectionManager();
            }
            // return reference to connection manager
            return singleton;
        }

        /**
         *  check if connected to the network
         *  A network connection is considered to be available if any network 
         *  interface is marked "up" and is not a loopback or tunnel interface
         */
        protected internal bool isNetworkConnected()
        {
            return System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
        }


    }
}
